package com.nuanshui.heatedloan.credit.service;

import com.nuanshui.framework.consts.TransactionManagerType;
import com.nuanshui.heatedloan.baseservice.service.CommonServiceImpl;
import com.nuanshui.heatedloan.constant.ServiceConstant;
import com.nuanshui.heatedloan.credit.dal.mapper.CustomerCompanyInfoMapper;
import com.nuanshui.heatedloan.credit.facade.CustomerCompanyInfoService;
import com.nuanshui.heatedloan.credit.form.CustomerCompanyInfoForm;
import com.nuanshui.heatedloan.credit.vo.CustomerCompanyInfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by wangxw on 2017/7/4.
 */

@Transactional(readOnly=true,value= TransactionManagerType.CREDIT_TRANSACTION_MANAGER)
@Service(ServiceConstant.CUSTOMERBCOMPANYINFOSERVICE)
public class CustomerCompanyInfoServiceImpl extends CommonServiceImpl implements CustomerCompanyInfoService {

    @Autowired
    private CustomerCompanyInfoMapper customerCompanyInfoMapper;

    @Override
    @Transactional(readOnly=false,value= TransactionManagerType.CREDIT_TRANSACTION_MANAGER)
    public void save(CustomerCompanyInfoForm customerCompanyInfoForm) {
        customerCompanyInfoMapper.save(customerCompanyInfoForm);
    }

    @Override
    @Transactional(readOnly=false,value= TransactionManagerType.CREDIT_TRANSACTION_MANAGER)
    public void update(CustomerCompanyInfoForm customerCompanyInfoForm) {
        customerCompanyInfoMapper.update(customerCompanyInfoForm);
    }

    @Override
    public CustomerCompanyInfoVO loadVO(String id) {
        return customerCompanyInfoMapper.loadVO(id);
    }

    @Override
    public CustomerCompanyInfoVO loadVOByUserId(String userId) {
        return customerCompanyInfoMapper.loadVOByUserId(userId);
    }

    @Override
    @Transactional(readOnly=false,value= TransactionManagerType.CREDIT_TRANSACTION_MANAGER)
    public void delete(String id) {
        customerCompanyInfoMapper.delete(id);
    }
}
